package org.tea.inventory.db.util;

import org.apache.commons.lang3.EnumUtils;

import java.util.List;
import java.util.Map;

/**
 * 常用类
 */
public class CommonUtil {

    /**
     * 根据PK得分名称返回名称
     * @param score PK的得分
     * @return
     */
    public static String getLevel(int score){
        String level = "热血青铜";
        String level2 = "Ⅴ";
        if(score == 0 ){
            return level+level2;
        }
        //段位分级
        if(score%100 == 0){
            level2 = "Ⅰ";
        }else if(score%100 <= 20){
            level2 = "Ⅴ";
        }else if(score%100 <= 40){
            level2 = "Ⅳ";
        }else if(score%100 <= 60){
            level2 = "Ⅲ";
        }else if(score%100 <= 80){
            level2 = "Ⅱ";
        }else if(score%100 < 100){
            level2 = "Ⅰ";
        }
        //段位名称
        if(score <= 100){
            level = "热血青铜";
            return level + level2;
        }else if(score <= 200){
            level = "不屈白银";
            return level + level2;
        }else if(score <= 300){
            level = "英勇黄金";
            return level + level2;
        }else if(score <= 400){
            level = "坚韧铂金";
            return level + level2;
        }else if(score <= 500){
            level = "不朽星钻";
            return level + level2;
        }else if(score <= 600){
            level = "荣誉皇冠";
            return level + level2;
        }else if(score <= 700){
            level = "超级王牌";
            return level;
        }else{
            level = "无敌战神";
            return level;
        }
    }
    public static String joinInSql(List<Object> params){
        StringBuffer sbuffer= new StringBuffer();
        for(Object s: params) {
            sbuffer.append("\'" +s.toString() + "\',");
        }
       return sbuffer.substring(0, sbuffer.length() - 1).toString() ;
    }


}
